/**
 * 本地存储封装模块
 */

 const local = window.localStorage

 // 获取
 export const getStorageItem = key => {
   const data = local.getItem(key)
   try {
     return JSON.parse(data)
   } catch (error) {
     return data
   }
 }
 
 // 设置
 export const setStorageItem = (key, value) => {
   if (typeof value === 'object') {
     value = JSON.stringify(value)
   }
   local.setItem(key, value)
 }
 
 // 删除
 export const removeStorageItem = key => {
   local.removeItem(key)
 }